/*
* Really easy field validation with Prototype
* http://tetlaw.id.au/view/javascript/really-easy-field-validation
* Andrew Tetlaw
* Version 1.5.4.1 (2007-01-05)
* 
* Copyright (c) 2007 Andrew Tetlaw
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* 
*/
var Validator = Class.create();

Validator.prototype = {
	initialize : function(className, error, test, options) {
		if(typeof test == 'function'){
			this.options = $H(options);
			this._test = test;
		} else {
			this.options = $H(test);
			this._test = function(){return true};
		}
		this.error = error || 'Validation failed.';
		this.className = className;
	},
	test : function(v, elm) {
		return (this._test(v,elm) && this.options.all(function(p){
			return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true;
		}));
	}
}
Validator.methods = {
	pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)},
	minLength : function(v,elm,opt) {return v.length >= opt},
	maxLength : function(v,elm,opt) {return v.length <= opt},
	min : function(v,elm,opt) {return v >= parseFloat(opt)}, 
	max : function(v,elm,opt) {return v <= parseFloat(opt)},
	notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) {
		return v != value;
	})},
	oneOf : function(v,elm,opt) {return $A(opt).any(function(value) {
		return v == value;
	})},
	is : function(v,elm,opt) {return v == opt},
	isNot : function(v,elm,opt) {return v != opt},
	equalToField : function(v,elm,opt) {return v == $F(opt)},
	notEqualToField : function(v,elm,opt) {return v != $F(opt)},
	include : function(v,elm,opt) {return $A(opt).all(function(value) {
		return Validation.get(value).test(v,elm);
	})}
}

var Validation = Class.create();

Validation.prototype = {
	initialize : function(form, options){
		this.options = Object.extend({
			onSubmit : true,
			stopOnFirst : false,
			immediate : false,
			focusOnError : true,
			useTitles : false,
			onFormValidate : function(result, form) {},
			onElementValidate : function(result, elm) {}
		}, options || {});
		this.form = $(form);
		if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false);
		if(this.options.immediate) {
			var useTitles = this.options.useTitles;
			var callback = this.options.onElementValidate;
			Form.getElements(this.form).each(function(input) { // Thanks Mike!
				Event.observe(input, 'blur', function(ev) { Validation.validate(Event.element(ev),{useTitle : useTitles, onElementValidate : callback}); });
			});
		}
	},
	onSubmit :  function(ev){
		if(!this.validate()) Event.stop(ev);
	},
	validate : function() {
		var result = false;
		var useTitles = this.options.useTitles;
		var callback = this.options.onElementValidate;
		if(this.options.stopOnFirst) {
			result = Form.getElements(this.form).all(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		} else {
			result = Form.getElements(this.form).collect(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); }).all();
		}
		if(!result && this.options.focusOnError) {
			try {
				Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus();
			}
			catch (e) {}
		}
		this.options.onFormValidate(result, this.form);
		return result;
	},
	reset : function() {
		Form.getElements(this.form).each(Validation.reset);
	}
}

Object.extend(Validation, {
	validate : function(elm, options){
		options = Object.extend({
			useTitle : false,
			onElementValidate : function(result, elm) {}
		}, options || {});
		elm = $(elm);
		var cn = elm.classNames();

		// Fail Fast
		return result = cn.all(function(value) {
			var test = Validation.test(value,elm,options.useTitle);
			options.onElementValidate(test, elm);
			return test;
		});
		
		// LC Bug Fix - Default behavior is to fail fast at field level, causes issue if multiple errors are displayed.
		// Validation errors coming after current failure aren't tested so message is not cleared even though it may have been corrected.
		// Update to run all validations for a given field.
//		return result = cn.collect(function(value) {
//			var test = Validation.test(value,elm,options.useTitle);
//			options.onElementValidate(test, elm);
//			return test;
//		}).all();
		
	},
	test : function(name, elm, useTitle) {
		var containerExists = elm.parentNode.className.indexOf("validation-container")!= -1;
		var separateMessage = elm.className.indexOf("message-separate")!= -1;
		var newId = elm.id + "ValidationMsg";
		var elmValidationDiv = document.getElementById(newId);		
		var checkIconId = elm.id + "Check";
		var elmCheckIcon = document.getElementById(checkIconId);	
		var checkBubbleId = elm.id + "CheckBubble";
		var elmCheckBubble = document.getElementById(checkBubbleId);	
		var errorIconId = elm.id + "Error";
		var elmErrorIcon = document.getElementById(errorIconId);	
		var errorBubbleId = elm.id + "ErrorBubble";
		var elmErrorBubble = document.getElementById(errorBubbleId);
		var v = Validation.get(name);
		var prop = '__advice'+name.camelize();
		try {
		if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
			if(!elm[prop]) {
				var advice = Validation.getAdvice(name, elm);
				if(advice == null) {
					var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
					advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>'
					switch (elm.type.toLowerCase()) {
						case 'checkbox':
						case 'radio':
							var p = elm.parentNode;
							if(p) {
								new Insertion.Bottom(p, advice);
							} else {
								new Insertion.After(elm, advice);
							}
							break;
						default:
							if (separateMessage && elmValidationDiv){
								new Insertion.Bottom(elmValidationDiv, advice);
							}else if (containerExists){
								new Insertion.After(elm.parentNode, advice);
							}else{
								new Insertion.After(elm, advice);
							}
				    }
					advice = Validation.getAdvice(name, elm);
				}
				if(typeof Effect == 'undefined') {
					if (elmErrorIcon || elmCheckIcon){
					}else{
						advice.style.display = 'block';
					}
				} else {
					if (elmErrorIcon || elmCheckIcon){
					}else{
					}
					new Effect.Appear(advice, {duration : 1 });
				}
			}
			elm[prop] = true;
			elm.removeClassName('validation-passed');
			if (elmCheckIcon){elmCheckIcon.style.display = 'none';}
			if (elmCheckBubble){elmCheckBubble.style.display = 'none';}
			elm.addClassName('validation-failed');
			if (elmErrorIcon){
				var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
				elmErrorIcon.innerHTML = errorMsg;
				elmErrorIcon.style.display = 'inline-block';
				if (elmErrorBubble){elmErrorBubble.style.display = 'block';}
			}
			return false;
		} else {
			var advice = Validation.getAdvice(name, elm);
			if(advice != null) advice.hide();
			elm[prop] = '';
			elm.removeClassName('validation-failed');
			elm.addClassName('validation-passed');
			if (elmCheckIcon){
				elmCheckIcon.style.display = 'inline-block';
				if (elmCheckBubble){elmCheckBubble.style.display = 'block';}
			}
			if (elmErrorIcon){elmErrorIcon.style.display = 'none';}
			if (elmErrorBubble){elmErrorBubble.style.display = 'none';}
			return true;
		}
		} catch(e) {
			throw(e)
		}
	},
	isVisible : function(elm) {
		while(elm.tagName != 'BODY') {
			if(!$(elm).visible()) return false;
			elm = elm.parentNode;
		}
		return true;
	},
	getAdvice : function(name, elm) {
		return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm));
	},
	getElmID : function(elm) {
		return elm.id ? elm.id : elm.name;
	},
	reset : function(elm) {
		elm = $(elm);
		
		// LC Bug Fix.  Hide Custom xxxError elements if present.
		var elmErrorIcon = $(elm.id + "Error");
		if (elmErrorIcon){elmErrorIcon.hide();}
		var elmErrorBubble = $(elm.id + "ErrorBubble");
		if (elmErrorBubble){elmErrorBubble.hide();}
		// LC Bug Fix.  Hide Custom xxxCheck elements if present.
		var elmCheckIcon = $(elm.id + "Check");
		if (elmCheckIcon){elmCheckIcon.hide();}
		var elmCheckBubble = $(elm.id + "CheckBubble");
		if (elmCheckBubble){elmCheckBubble.hide();}
		
		var cn = elm.classNames();
		cn.each(function(value) {
			var prop = '__advice'+value.camelize();
			if(elm[prop]) {
				var advice = Validation.getAdvice(value, elm);
				advice.hide();
				elm[prop] = '';
			}
			elm.removeClassName('validation-failed');
			elm.removeClassName('validation-passed');
		});
	},
	add : function(className, error, test, options) {
		var nv = {};
		nv[className] = new Validator(className, error, test, options);
		Object.extend(Validation.methods, nv);
	},
	addAllThese : function(validators) {
		var nv = {};
		$A(validators).each(function(value) {
				nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {}));
			});
		Object.extend(Validation.methods, nv);
	},
	get : function(name) {
		return  Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_'];
	},
	methods : {
		'_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{})
	}
});

Validation.add('IsEmpty', '', function(v) {
				return  ((v == null) || (v.length == 0)) || /^\s+$/.test(v); // || /^\s+$/.test(v));
			});

Validation.addAllThese([
	['required', 'This is a required field.', function(v) {
				return !Validation.get('IsEmpty').test(v);
			}],
	['validate-number', 'Please enter a valid number in this field.', function(v) {
				return Validation.get('IsEmpty').test(v) || (!isNaN(v) && !/^\s+$/.test(v));
			}],
	['validate-number-no-space', 'Please enter a valid number in this field.', function(v) {
		return !Validation.get('IsEmpty').test(v) || (!isNaN(v) && !/^\s+$/.test(v));
			}],
	['validate-digits', 'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.', function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
			}],
	['validate-alpha', 'Please use letters only (a-z) in this field.', function (v) {
				return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z]+$/.test(v);
			}],
	['validate-us-state', 'Please enter valid state code.', function (v) {
				return Validation.get('IsEmpty').test(v) ||  /^(?:A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])*$/.test(v);
			}],
	['validate-india-state', 'Please enter valid state code.', function (v) {
		return Validation.get('IsEmpty').test(v) || /^(?:A[PRSN]|BR|C[TH]|D[DNL]|G[AJ]|H[RP]|J[KH]|K[AL]|M[PHNLZ]|NL|LD|OR|P[BY]|RJ|SK|T[NR]|U[TP]|WB)*$/.test(v);
	}],
	['validate-alpha-space', 'Please use letters only (a-z) in this field.', function (v) {
				return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z\s]+$/.test(v);
			}],
	['validate-alphanum', 'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/\W/.test(v);
			}],
	['validate-date', 'Please enter a valid date.', function(v) {
				var test = new Date(v);
				return Validation.get('IsEmpty').test(v) || !isNaN(test);
			}],
	['validate-email', 'Please enter a valid email address. For example fred@domain.com .', function (v) {
				return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v);
			}],
	['validate-url', 'Please enter a valid URL.', function (v) {
				return Validation.get('IsEmpty').test(v) || /^(https?\:\/\/www\.|https?\:\/\/|www\.){1}[a-z0-9-]+(\.[a-z0-9-]+)+([\/?].*)?$/i.test(v);		
			}],
	['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
				if(Validation.get('IsEmpty').test(v)) return true;
				var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
				if(!regex.test(v)) return false;
				var d = new Date(v.replace(regex, '$2/$1/$3'));
				return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 
							(parseInt(RegExp.$1, 10) == d.getDate()) && 
							(parseInt(RegExp.$3, 10) == d.getFullYear() );
			}],
	['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00 .', function(v) {
				// [$]1[##][,###]+[.##]
				// [$]1###+[.##]
				// [$]0.##
				// [$].##
				return Validation.get('IsEmpty').test(v) ||  /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v);
			}],
	['validate-currency-rupee', 'Please enter a valid Rs. amount.', function(v) {
		// [$]1[##][,###]+[.##]
		// [$]1###+[.##]
		// [$]0.##
		// [$].##
		return Validation.get('IsEmpty').test(v) ||  /^(?:0|[1-9]\d*)(?:\.(?!.*000)\d+)?$/.test(v);
	}],

	['validate-selection', 'Please make a selection', function(v,elm){
				return elm.options ? elm.selectedIndex > 0 : !Validation.get('IsEmpty').test(v);
			}],
	['validate-one-required', 'Please select one of the above options.', function (v,elm) {
				var p = elm.parentNode;
				var options = p.getElementsByTagName('INPUT');
				return $A(options).any(function(elm) {
					return $F(elm);
				});
			}],
	// Out of the box 'validate-one-required' validator doesn't work with spring form:checkbox tags
	// Use this one instead
	['validate-one-required-spring', 'Please select one of the above options.', function(v,elm){
				return YAHOO.util.Selector.query("input[name=" + elm.name + "]:checked").length > 0;
			}],
	['validate-area-code', 'Area Code must be 3 digits.', {pattern : /^\d{3}$/}],
	['validate-prefix', 'Prefix must be 3 digits.', {pattern : /^\d{3}$/}],
	['validate-line-number', 'Line Number must be 4 digits.', {pattern : /^\d{4}$/}],
	['validate-zip-five', 'Zip code must be 5 digits.', {pattern : /^\d{5}$/}],
	['validate-zip-USA', 'Zip code must be of the format XXXXX.', {pattern : /^\d{5}$/}],
	['validate-zip-MEX', 'Zip code must be of the format XXXXX.', {pattern : /^\d{5}$/}],
	['validate-zip-CAN', 'Zip Code Must be of the format XXX XXX.', {pattern : /^[A-Z0-9][A-Z0-9][A-Z0-9] [A-Z0-9][A-Z0-9][A-Z0-9]$/i}],
	['validate-zip-india', 'Zip code must be of the format XXXXX.', {pattern : /^[1-9]{3}\s{0,1}[0-9]{3}$/}],
	['validate-zip-five-or-nine', 'Zip code must be either 5 or 9 digits.', {pattern: /^\d{5}([\-]\d{4})?$/}],
	['validate-phone-number', 'Invalid phone number.', {pattern: /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/}],
	['validate-india-phone-number', 'Invalid phone number.', {pattern: /^(?:\+91(?:-)?|0\d{2,4}-|0|)\d{7,10}$/}],
	['validate-date-mmddyyyy', 'Invalid date.', function(v) {
		if (v.length == 0) return true;

		if ( isFutureDate(v)) return false; // future date is not allowed
		
		// MM/dd/yyyy
		var dateRegex=/^\d{2}\/\d{2}\/\d{4}$/; //Basic check for format validity
		if (!dateRegex.test(v))
			return false;
		else {
			// check date range
			var splittedDate = v.split("/");
			var monthfield = splittedDate[0];
			var dayfield = splittedDate[1];
			var yearfield = splittedDate[2];

			var dayobj = new Date(yearfield, monthfield-1, dayfield);
			if ( (dayobj.getMonth()+1!= monthfield)||
				 (dayobj.getDate()!= dayfield)||
				 (dayobj.getFullYear()!= yearfield) )
				return false;
			else
				return true;
		}
	}],
	['validate-acceptfuture-date-mmddyyyy', 'Invalid date.', function(v) {
		if (v.length == 0) return true;
		return isValidDateForValidator(v, "MM/dd/yyyy");
	}],
	['validate-acceptfuture-date-ddmmyyyy', 'Invalid date.', function(v) {
		if (v.length == 0) return true;
		return isValidDateForValidator(v, "dd/MM/yyyy");
	}],
	['validate-date-mmddyy', 'Invalid date.', function(v) {
		if (v.length == 0) return true;
		return isValidDateForValidator(v, "MM/dd/yy");
	}],
	['validate-date-MM/DD/YYYY', 'Invalid date.', function(v) {
		if (v.length == 0) return true;
		return isValidDateForValidator(v, "MM/dd/yyyy");
	}],
	['validate-date-MM/dd/yyyy', 'Invalid date.', function(v) {
		if (v.length == 0) return true;
		return isValidDateForValidator(v, "MM/dd/yyyy");
	}],
	['validate-date-dd/MM/yyyy', 'Invalid date.', function(v) {
		if (v.length == 0) return true;
		return isValidDateForValidator(v, "dd/MM/yyyy");
	}],
	['validate-loginid', 'Invalid Login ID.',{pattern : /^[A-Za-z0-9_@.-]{5,35}$/}],
	['validate-ssn','Invalid SSN', function(v) {
        		if (v.length == 0) return true; // do not check
        		
				//var regex = /^([0-6]\d{2}|7[0-6]\d|77[0-2])([ \-]?)(\d{2})\2(\d{4})$/; 
        		var regex = /^([0-9]\d{2})([ \-]?)(\d{2})\2(\d{4})$/;
				if (!regex.test(v)) { return false; } 
				var temp = v; 
			    if (v.indexOf("-") != -1) { temp = (v.split("-")).join(""); } 
			    if (v.indexOf(" ") != -1) { temp = (v.split(" ")).join(""); } 
			    if (temp.substring(0, 3) == "000") { return false; } 
			    if (temp.substring(3, 5) == "00") { return false; } 
			    if (temp.substring(5, 9) == "0000") { return false; } 
			    return true; 			     
			}],
	['validate-person-name','Alpha-numeric  -  \' space only', function(v) {
        		if (v.length == 0) return true; // do not check
        		
        		var regex = /^[\p{a-zA-Z0-9} '\-]+$/; 
				if (!regex.test(v)) { return false; }
			    return true; 			     
			}],
	['validate-name','Invalid Person Name', function(v) {
        		if (v.length == 0) return true; // do not check
        		
        		var regex = /^[a-zA-Z0-9]+(([\'\,\.\- ][a-zA-Z0-9 ])?[a-zA-Z0-9]*)*/; 
				if (!regex.test(v)) { return false; }
			    return true; 			     
			}],			
	['validate-org-name','Allows following special chars (\\.\'-_&/*+:;,) and space.', function(v) {
        		if (v.length == 0) return true; // do not check
        		
        		var regex = /^[\a-zA-Z0-9 '&._\/\\*+:;,-]+$/; 
				if (!regex.test(v)) { return false; }
			    return true; 			     
			}],			
	['validate-mrn-number','Please exclude: |, ^, ~, \\, &, <, >, #', function(v) {
        		if (v.length == 0) return true; // do not check
        		
        		var regex = /^[^|^\\\\&<>~#]*$/; 
				if (!regex.test(v)) { return false; }
			    return true; 			     
			}],
	['validate-special-char','Please exclude:<br>^,!,@,#,$,%,^,&,*,(,),+,=,[,],\,\',;,.,/,{,},",|,:,<,>,?', function(v) {
        		if (v.length == 0) return true; // do not check
        		
        		var regex = /^[^!@#$%^&*()+=\[\]\\';,.\/\{}|\":<>?]*$/; 
				if (!regex.test(v)) { return false; }
			    return true; 			     
			}],
	['validate-medicare-subscriber-number','Must be one of the following formats: $#########, $$#########, $$$######, $$$#########, $$######, $$$$######, $#####, #########$, #########$+', function(v) {
        		if (v.length == 0) return true; // do not check        		
//        		/****Key*****/
//        		//$ = Alpha 
//        		//# = Numeric 
//        		//+ = Alpha Numeric
//        		/****Medicare railroad carriers****/
//        		//$#########
        		var railRoadRegex1 = /^([a-zA-Z])(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)$/;
//        		//$$#########
        		var railRoadRegex2 = /^([a-zA-Z])([a-zA-Z])(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)$/;
//        		//$$$######
        		var railRoadRegex3 = /^([a-zA-Z])([a-zA-Z])([a-zA-Z])(\d)(\d)(\d)(\d)(\d)(\d)$/; 
//        		//$$$#########  
        		var railRoadRegex4 = /^([a-zA-Z])([a-zA-Z])([a-zA-Z])(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)$/; 
//        		//$$######
        		var railRoadRegex5 = /^([a-zA-Z])([a-zA-Z])(\d)(\d)(\d)(\d)(\d)(\d)$/;
//        		//$$$$######
        		var railRoadRegex6 = /^([a-zA-Z])([a-zA-Z])([a-zA-Z])([a-zA-Z])(\d)(\d)(\d)(\d)(\d)(\d)$/;
//        		//$#####
        		var railRoadRegex7 = /^([a-zA-Z])(\d)(\d)(\d)(\d)(\d)$/;
//        		/*****Medicare Part B*****/        		
//        		//#########$
        		var partBRegEx1 = /^(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)([a-zA-Z])$/;
//        		//#########$+
        		var partBRegEx2 = /^(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)([a-zA-Z])([a-zA-Z0-9])$/;
//        		//if any regex tests pass, it is a valid medicare subscriber #
				if (railRoadRegex1.test(v) || railRoadRegex2.test(v) || railRoadRegex3.test(v) || 
						railRoadRegex4.test(v) || railRoadRegex5.test(v) || railRoadRegex6.test(v) || 
						railRoadRegex7.test(v) || partBRegEx1.test(v) || partBRegEx2.test(v)) { return true; }
			    return false;
			}]
]);
